package com.szpx.service.impl;

import com.szpx.entity.Movie;
import com.szpx.mapper.CinemaHomeMapper;
import com.szpx.service.CinemaHomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class CinemaHomeServiceImpl implements CinemaHomeService {

    @Autowired
    private CinemaHomeMapper cinemaHomeMapper;


    //根据id查询影片的信息
    @Override
    public Movie selectMovieById(Integer id) {
        return cinemaHomeMapper.selectByPrimaryKey(id);
    }

    //查询所有影片的信息
    @Override
    public List<Movie> selectAllMovie() {
        return cinemaHomeMapper.selectAll();
    }

    //添加影片信息
    @Override
    public int addMovie(Movie movie) {
        return cinemaHomeMapper.insertSelective(movie);
    }

    //删除影片信息
    @Override
    public int deleMovie(Integer id) {
        return cinemaHomeMapper.deleteByPrimaryKey(id);
    }

    //修改用户的信息
    @Override
    public int updateMovie(Movie movie) {
        return cinemaHomeMapper.updateByPrimaryKeySelective(movie);
    }

    //多条件分页模糊查询
    @Override
    public List<Movie> getListByMovie(Movie movie) {
        return cinemaHomeMapper.getListByMovie(movie);
    }

}
